<h1>Listing contractors</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Street</th>
	<th>City</th>
    <th>Postal code</th>
	<th>Country</th>
    <th>Phone number</th>
    <th>NIP</th>
    <th>REGON</th>
  </tr>
  <% form_tag :action => 'filter' do %></td>
  <tr>
    <td><%= text_field("filter", "contractor_name", :size => 25) %></td>
	<td><%= text_field("filter", "contractor_street", :size => 25) %></td>
	<td><%= text_field("filter", "contractor_city", :size => 15) %></td>
	<td><%= text_field("filter", "contractor_postal_code", :size => 10) %></td>
	<td><%= text_field("filter", "contractor_country", :size => 15) %></td>
	<td><%= text_field("filter", "contractor_phone_number", :size => 15) %></td>
	<td><%= text_field("filter", "contractor_nip", :size => 15) %></td>
	<td><%= text_field("filter", "contractor_regon", :size => 15) %></td>
	
    <td><input type="submit" value="Filter" /></td>
  </tr>
  <%end%>
<% @contractors.each do |contractor| %>
  <tr>
    <td><%=h contractor.name %></td>
    <td><%=h contractor.street %></td>
    <td><%=h contractor.city %></td>
    <td><%=h contractor.postal_code %></td>
    <td><%=h contractor.country %></td>
    <td><%=h contractor.phone_number %></td>
    <td><%=h contractor.nip %></td>
    <td><%=h contractor.regon %></td>
	<td/>
    <td><%= link_to 'Show', contractor %></td>
    <td><%= link_to 'Edit', edit_contractor_path(contractor) %></td>
    <td><%= link_to 'Delete', contractor, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New contractor', new_contractor_path %>